﻿/*******************************************************************
 * 作者：董辉
 * 类型：修改
 * 时间：2011-4-9 14:27
 * 说明：之前绑定图表的方法存在错误与逻辑上的不合理，故而修改成适用
 *       安徽的图表绑定方式
 * ****************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using HZ.Supervise.Model;
using System.Text;
using System.Web.UI.DataVisualization.Charting;
using System.Drawing;
using HZ.Supervise.Model.Enum;

namespace HZ.Supervise.Web.Secondphase.Comparison
{
    public partial class ComparisonByHospital : BasePage
    {

        DataTable dt = new DataTable();

        string[] hid = { "" };

        string hids = "";

        string timefrom = "";

        string timeto = "";

        public ComparisonByHospital()
        {
          
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            timefrom = Request["timefrom"];
            timeto = Request["timeto"];
            hids = Request["Hid"];
            hid = Request["Hid"].Split(',');
            if (!IsPostBack)
            {
                dataBind();

                BindChart();
            }
        }

        /// <summary>
        /// 数据绑定
        /// </summary>
        public void dataBind()
        {
            SuperviseQuery sq = new SuperviseQuery();
            StringBuilder strid = new StringBuilder();
            foreach (string item in hid)
            {
                if (!string.IsNullOrEmpty(item))
                {
                    strid.Append("'" + item + "',");
                }
            }

            HZ.Supervise.IBLL.IExecuteContext ie = HZ.Supervise.BLLFactory.ExecuteContext();

            string whereHos = "and HospitalID in(" + strid.Remove(strid.Length - 1, 1).ToString() + ")";

            if (string.IsNullOrEmpty(timeto) || string.IsNullOrEmpty(timefrom)) { }
            else
            {
                whereHos += " and (DayTime >=" + this.timefrom + " and DayTime<=" + this.timeto + ")";
            }
            DataTable dt2 = ie.ExecuteHospital(whereHos);

            dt = dt2.Copy();

            HZ.Supervise.Web.Function.AddColumn(dt2, "WareHouseRate", "SortSource");
            HZ.Supervise.Web.Function.ChangeRate(dt2, "DistributeRate", "addDistributeRate");
            gvwHosComparison.DataSource = dt2;//曹鹏 2011年5月4日16:03:40 给数据源增加一新列

            gvwHosComparison.DataBind();

            HZ.Supervise.Web.Function.Combine(gvwHosComparison);

            // //合并单元格
            //SpanCells();
        }

        protected void gvwProcureCatalog_RowDataBound(object sender, GridViewRowEventArgs e)
        {

        }

        public string getSortSource(object SortSource)
        {
            return HZ.Supervise.Web.Function.FormatDrugSourceByName(SortSource.ToString()).Trim();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {

        }

        protected void btnExcel_Click(object sender, EventArgs e)
        {
            SuperviseQuery sq = new SuperviseQuery();
            StringBuilder strid = new StringBuilder();
            foreach (string item in hid)
            {
                if (!string.IsNullOrEmpty(item))
                {
                    strid.Append("'" + item + "',");
                }
            }

            HZ.Supervise.IBLL.IExecuteContext ie = HZ.Supervise.BLLFactory.ExecuteContext();

            string whereHos = "and HospitalID in(" + strid.Remove(strid.Length - 1, 1).ToString() + ")";

            if (string.IsNullOrEmpty(timefrom) || string.IsNullOrEmpty(timeto)) { }
            else
            {

                whereHos += " and (DayTime >=" + this.timefrom + " and DayTime<=" + this.timeto + ")";
            }
            DataTable dt2 = ie.ExecuteHospital(whereHos);

            dt = dt2.Copy();

            HZ.Supervise.Web.Function.AddColumn(dt2, "WareHouseRate", "SortSource");

            HZ.Supervise.Web.Function.ChangeRate(dt2, "DistributeRate", "addDistributeRate");

            gvwHosComparison.DataSource = dt2;//曹鹏 2011年5月4日16:03:40 给数据源增加一新列

            HZ.Excel.ExcelHelper.ExportDataForWeb(dt2, this.gvwHosComparison);
        }


        /// <summary>
        /// 绑定金额与数量的图表数据
        /// 董辉
        /// 2011-4-9 14:20
        /// </summary>
        private void BindChart()
        {


            //用于排序后的新的数据集合
            DataTable NewDatatable = new DataTable();

            //基本药物目录循环因子
            //int BaseI = 0;

            //补充目录循环因子
            //int ComplementI = 0;

            //日常采购目录循环因子
            int Base_2010I = 0;

            ////临时采购目录循环因子
            int PriceFixing_2010I = 0;

            ////应急采购目录循环因子
            int Complementarity_2010I = 0;

            //医院名称
            string HospitalName = string.Empty;


            //声明dataview对象，并把dt传给dataview
            DataView dv = dt.DefaultView;

            //指定dataview按中文进行排序
            dv.Table.Locale = new System.Globalization.CultureInfo("zh-CN");

            //排序条件为医院
            dv.Sort = " HospitalName desc ";

            //排序后的集合传给新的datatable
            NewDatatable = dv.ToTable();


            /***********************************************************************************************/

            //日常采购
            Series BasicCatalog_2010_Money = new Series("日常采购");

            //设置图表类型为柱状图
            BasicCatalog_2010_Money.ChartType = SeriesChartType.Column;
            BasicCatalog_2010_Money.MarkerStyle = MarkerStyle.Diamond;

            //设置图表边宽
            BasicCatalog_2010_Money.BorderWidth = 1;

            //设置图表偏移量
            BasicCatalog_2010_Money.ShadowOffset = 1;

            /***********************************************************************************************/

            //临时采购目录采购金额序列
            Series PriceFixing_2010_Money = new Series("临时采购");

            //设置图表类型为柱状图
            PriceFixing_2010_Money.ChartType = SeriesChartType.Column;
            PriceFixing_2010_Money.MarkerStyle = MarkerStyle.Diamond;
            //PriceFixing_2010_Money.Color = Color.Blue;

            //设置图表边宽
            PriceFixing_2010_Money.BorderWidth = 1;

            //设置图表偏移量
            PriceFixing_2010_Money.ShadowOffset = 1;

            /***********************************************************************************************/

            //应急采购目录采购金额序列
            Series ComplementarityCatalog_2010_Money = new Series("应急采购");

            //设置图表类型为柱状图
            ComplementarityCatalog_2010_Money.ChartType = SeriesChartType.Column;

            //ComplementarityCatalog_2010_Money.Color = Color.Red;
            ComplementarityCatalog_2010_Money.MarkerStyle = MarkerStyle.Diamond;
            //设置图表边宽
            ComplementarityCatalog_2010_Money.BorderWidth = 1;

            //设置图表偏移量
            ComplementarityCatalog_2010_Money.ShadowOffset = 1;


            BasicCatalog_2010_Money.Label = "#VAL{F}";
            BasicCatalog_2010_Money.Color = Color.FromArgb(74, 172, 197);
            PriceFixing_2010_Money.Label = "#VAL{F}";
            PriceFixing_2010_Money.Color = Color.FromArgb(129, 101, 162);
            ComplementarityCatalog_2010_Money.Label = "#VAL{F}";
            ComplementarityCatalog_2010_Money.Color = Color.FromArgb(192, 80, 78);


            //日常采购
            Series BasicCatalog_2010_PSRate = new Series("日常采购");

            //设置图表类型为柱状图
            BasicCatalog_2010_PSRate.ChartType = SeriesChartType.Column;

            BasicCatalog_2010_PSRate.Color = Color.DarkGray;

            //设置图表边宽
            BasicCatalog_2010_PSRate.BorderWidth = 1;

            //设置图表偏移量
            BasicCatalog_2010_PSRate.ShadowOffset = 1;

            BasicCatalog_2010_PSRate.IsValueShownAsLabel = true;

            //BasicCatalog_2010_PSRate.Label = "#PERCENT{P}";

            BasicCatalog_2010_PSRate.Color = Color.FromArgb(74, 172, 197);

            /***********************************************************************************************/

            //临时采购目录配送率序列
            Series PriceFixing_2010_PSRate = new Series("临时采购");

            //设置图表类型为柱状图
            PriceFixing_2010_PSRate.ChartType = SeriesChartType.Column;

            //设置图表边宽
            PriceFixing_2010_PSRate.BorderWidth = 1;

            //设置图表偏移量
            PriceFixing_2010_PSRate.ShadowOffset = 1;

            PriceFixing_2010_PSRate.IsValueShownAsLabel = true;

            //PriceFixing_2010_PSRate.Label = "#PERCENT{P}";

            PriceFixing_2010_PSRate.Color = Color.FromArgb(129, 101, 162);

            /***********************************************************************************************/

            //应急采购目录配送率序列
            Series ComplementarityCatalog_2010_PSRate = new Series("应急采购");

            //设置图表类型为柱状图
            ComplementarityCatalog_2010_PSRate.ChartType = SeriesChartType.Column;

            //设置图表边宽
            ComplementarityCatalog_2010_PSRate.BorderWidth = 1;

            //设置图表偏移量
            ComplementarityCatalog_2010_PSRate.ShadowOffset = 1;

            ComplementarityCatalog_2010_PSRate.IsValueShownAsLabel = true;

            ComplementarityCatalog_2010_PSRate.Color = Color.FromArgb(192, 80, 78);

            HZ.Supervise.Web.Function.ChangeRate(NewDatatable, "DistributeRate", "addDistributeRate");

            //如果数据源不为空同时又存在数据
            if (NewDatatable != null && NewDatatable.Rows.Count > 0)
            {
                for (int i = 0; i < NewDatatable.Rows.Count; i++)
                {
                    //如果为第一行，就初始化图表序列集合
                    if (i == 0)
                    {
                        //获取第一行中的医院名称
                        HospitalName = NewDatatable.Rows[0]["HospitalName"].ToString();

                        //根据SortSource采购类型来绑定序列集合的数据
                        switch (NewDatatable.Rows[0]["SortSource"].ToString())
                        {
                            //日常采购
                            case "0":

                                //初始化采购类型为0的序列集
                                InitBindChart(NewDatatable.Rows[0],
                                              "0",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                    PriceFixing_2010I,
                                    Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,
                                              BasicCatalog_2010_PSRate,
                                    PriceFixing_2010_PSRate,
                                    ComplementarityCatalog_2010_PSRate
                                              );

                                break;

                            //临时采购
                            case "1":

                                //初始化采购类型为1的序列集
                                InitBindChart(NewDatatable.Rows[0],
                                              "1",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                    PriceFixing_2010I,
                                    Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                    PriceFixing_2010_Money,
                                    ComplementarityCatalog_2010_Money,
                                            BasicCatalog_2010_PSRate,
                                    PriceFixing_2010_PSRate,
                                    ComplementarityCatalog_2010_PSRate
                            );
                                break;

                            //应急采购
                            case "2":

                                //初始化采购类型为3的序列集
                                InitBindChart(NewDatatable.Rows[0],
                                              "2",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                    PriceFixing_2010I,
                                    Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,
                                              BasicCatalog_2010_PSRate,
                                    PriceFixing_2010_PSRate,
                                    ComplementarityCatalog_2010_PSRate
                                              );
                                break;

                            ////临时采购目录
                            //case "5":

                            //    //初始化采购类型为5的序列集
                            //    InitBindChart(NewDatatable.Rows[0],
                            //                  "5",
                            //                  BaseI,
                            //                  ComplementI,
                            //                  Base_2010I,
                            //                  PriceFixing_2010I,
                            //                  Complementarity_2010I,
                            //                  BasicCatalog_2010_Money,
                            //                  PriceFixing_2010_Money,
                            //                  ComplementarityCatalog_2010_Money,
                            //                  BasicCatalog_2010_PSRate,
                            //                  PriceFixing_2010_PSRate,
                            //                  ComplementarityCatalog_2010_PSRate);
                            //    break;

                            ////应急采购目录
                            //case "6":

                            //    //初始化采购类型为6的序列集
                            //    InitBindChart(NewDatatable.Rows[0],
                            //                  "6",
                            //                  BaseI,
                            //                  ComplementI,
                            //                  Base_2010I,
                            //                  PriceFixing_2010I,
                            //                  Complementarity_2010I,

                            //                  BasicCatalog_2010_Money,
                            //                  PriceFixing_2010_Money,
                            //                  ComplementarityCatalog_2010_Money,
                            //                  BasicCatalog_2010_PSRate,
                            //                  PriceFixing_2010_PSRate,
                            //                  ComplementarityCatalog_2010_PSRate);
                            //    break;
                        }

                        //BaseI++;

                        //ComplementI++;

                        Base_2010I++;

                        PriceFixing_2010I++;

                        Complementarity_2010I++;

                        //跳过下边的语句重新循环
                        continue;
                    }

                    //不为第一行数据
                    //如果当前行的医院名称与上一行中的名称相同
                    if (NewDatatable.Rows[i]["HospitalName"].ToString().Equals(HospitalName))
                    {


                        switch (NewDatatable.Rows[i]["SortSource"].ToString())
                        {
                            //日常采购
                            case "0":

                                FinishBindChart(NewDatatable.Rows[i],
                                                "0",
                                    //BaseI,
                                    //ComplementI,
                                                Base_2010I,
                                                PriceFixing_2010I,
                                                Complementarity_2010I,
                                                BasicCatalog_2010_Money,
                                                PriceFixing_2010_Money,
                                                ComplementarityCatalog_2010_Money,
                                                BasicCatalog_2010_PSRate,
                                                PriceFixing_2010_PSRate,
                                                ComplementarityCatalog_2010_PSRate
                                                );
                                break;

                            //临时采购
                            case "1":

                                FinishBindChart(NewDatatable.Rows[i],
                                                "1",
                                    //BaseI,
                                    //ComplementI,
                                                Base_2010I,
                                                PriceFixing_2010I,
                                                Complementarity_2010I,
                                                BasicCatalog_2010_Money,
                                    PriceFixing_2010_Money,
                                    ComplementarityCatalog_2010_Money,
                                                BasicCatalog_2010_PSRate,
                                                PriceFixing_2010_PSRate,
                                                ComplementarityCatalog_2010_PSRate
                                                );
                                break;

                            //应急采购
                            case "2":

                                FinishBindChart(NewDatatable.Rows[i],
                                                "2",
                                                //BaseI,
                                                //ComplementI,
                                                Base_2010I,
                                    PriceFixing_2010I,
                                    Complementarity_2010I,
                                                BasicCatalog_2010_Money,
                                                PriceFixing_2010_Money,
                                                ComplementarityCatalog_2010_Money,
                                    BasicCatalog_2010_PSRate,
                                    PriceFixing_2010_PSRate,
                                    ComplementarityCatalog_2010_PSRate
                                              );
                                break;

                            ////临时采购目录
                            //case "5":

                            //    FinishBindChart(NewDatatable.Rows[i],
                            //                    "5",
                            //                    BaseI,
                            //                    ComplementI,
                            //                    Base_2010I,
                            //                    PriceFixing_2010I,
                            //                    Complementarity_2010I,
                            //                    BasicCatalog_2010_Money,
                            //                    PriceFixing_2010_Money,
                            //                    ComplementarityCatalog_2010_Money,
                            //                    BasicCatalog_2010_PSRate,
                            //                    PriceFixing_2010_PSRate,
                            //                    ComplementarityCatalog_2010_PSRate);
                            //    break;

                            ////应急采购目录
                            //case "6":

                            //    FinishBindChart(NewDatatable.Rows[i],
                            //                    "6",
                            //                    BaseI,
                            //                    ComplementI,
                            //                    Base_2010I,
                            //                    PriceFixing_2010I,
                            //                    Complementarity_2010I,
                            //                    BasicCatalog_2010_Money,
                            //                    PriceFixing_2010_Money,
                            //                    ComplementarityCatalog_2010_Money,
                            //                    BasicCatalog_2010_PSRate,
                            //                    PriceFixing_2010_PSRate,
                            //                    ComplementarityCatalog_2010_PSRate);
                            //    break;
                        }



                        //把当前行的医院名称重新赋值给变量
                        HospitalName = NewDatatable.Rows[i]["HospitalName"].ToString();
                    }
                    else
                    {


                        //根据SortSource采购类型来绑定序列集合的数据
                        switch (NewDatatable.Rows[i]["SortSource"].ToString())
                        {
                            //日常采购
                            case "0":

                                //初始化采购类型为0的序列集
                                InitBindChart(NewDatatable.Rows[i],
                                              "0",
                                    //BaseI,
                                    //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,
                                              BasicCatalog_2010_PSRate,
                                              PriceFixing_2010_PSRate,
                                              ComplementarityCatalog_2010_PSRate
                                              );

                                break;

                            //临时采购
                            case "1":

                                //初始化采购类型为1的序列集
                                InitBindChart(NewDatatable.Rows[i],
                                              "1",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                    PriceFixing_2010I,
                                    Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                    PriceFixing_2010_Money,
                                    ComplementarityCatalog_2010_Money,
                                              BasicCatalog_2010_PSRate,
                                    PriceFixing_2010_PSRate,
                                    ComplementarityCatalog_2010_PSRate
                                              );
                                break;

                            //应急采购
                            case "2":

                                //初始化采购类型为3的序列集
                                InitBindChart(NewDatatable.Rows[i],
                                              "2",
                                    //BaseI,
                                    //ComplementI,
                                              Base_2010I,
                                    PriceFixing_2010I,
                                    Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,
                                             BasicCatalog_2010_PSRate,
                                    PriceFixing_2010_PSRate,
                                    ComplementarityCatalog_2010_PSRate
                                              );
                                break;

                            ////临时采购目录
                            //case "5":

                            //    //初始化采购类型为5的序列集
                            //    InitBindChart(NewDatatable.Rows[i],
                            //                  "5",
                            //                  BaseI,
                            //                  ComplementI,
                            //                  Base_2010I,
                            //                  PriceFixing_2010I,
                            //                  Complementarity_2010I,
                            //                  BasicCatalog_2010_Money,
                            //                  PriceFixing_2010_Money,
                            //                  ComplementarityCatalog_2010_Money,
                            //                  BasicCatalog_2010_PSRate,
                            //                  PriceFixing_2010_PSRate,
                            //                  ComplementarityCatalog_2010_PSRate);
                            //    break;

                            ////应急采购目录
                            //case "6":

                            //    //初始化采购类型为6的序列集
                            //    InitBindChart(NewDatatable.Rows[i],
                            //                  "6",
                            //                  BaseI,
                            //                  ComplementI,
                            //                  Base_2010I,
                            //                  PriceFixing_2010I,
                            //                  Complementarity_2010I,
                            //                  BasicCatalog_2010_Money,
                            //                  PriceFixing_2010_Money,
                            //                  ComplementarityCatalog_2010_Money,
                            //                  BasicCatalog_2010_PSRate,
                            //                  PriceFixing_2010_PSRate,
                            //                  ComplementarityCatalog_2010_PSRate);
                            //    break;
                        }


                        //把当前行的医院名称重新赋值给变量
                        HospitalName = NewDatatable.Rows[i]["HospitalName"].ToString();

                        //BaseI++;

                        //ComplementI++;

                        Base_2010I++;

                        PriceFixing_2010I++;

                        Complementarity_2010I++;
                    }
                }

                //提示按钮隐藏
                this.lblnull.Visible = false;

                //2010基本药物采购金额加入图表中
                BasicCatalog_2010_Money.IsValueShownAsLabel = true;
                ChartMoney.Series.Add(BasicCatalog_2010_Money);
                ChartMoney.Series["日常采购"].ChartArea = "ChartMoneyArea";

                //临时采购目录采购金额序列
                PriceFixing_2010_Money.IsValueShownAsLabel = true;
                ChartMoney.Series.Add(PriceFixing_2010_Money);
                ChartMoney.Series["临时采购"].ChartArea = "ChartMoneyArea";

                //应急采购目录采购金额序列
                PriceFixing_2010_Money.IsValueShownAsLabel = true;
                ChartMoney.Series.Add(ComplementarityCatalog_2010_Money);
                ChartMoney.Series["应急采购"].ChartArea = "ChartMoneyArea";


                this.ChartInStorage.Series.Add(BasicCatalog_2010_PSRate);

                this.ChartInStorage.Series.Add(PriceFixing_2010_PSRate);

                this.ChartInStorage.Series.Add(ComplementarityCatalog_2010_PSRate);

                this.ChartInStorage.Series["日常采购"].ChartArea = "ChartCountArea";

                this.ChartInStorage.Series["临时采购"].ChartArea = "ChartCountArea";

                this.ChartInStorage.Series["应急采购"].ChartArea = "ChartCountArea";


                ChartInStorage.ChartAreas["ChartCountArea"].AxisX.IsMarginVisible = true;
                ChartInStorage.ChartAreas["ChartCountArea"].AxisX.LabelStyle.Font = new Font("宋体", 8);
                ChartInStorage.ChartAreas["ChartCountArea"].Area3DStyle.Enable3D = false;

                ChartInStorage.Series["日常采购"]["PointWidth"] = "0.5";
                ChartInStorage.Series["临时采购"]["PointWidth"] = "0.5";
                ChartInStorage.Series["应急采购"]["PointWidth"] = "0.5";

                ChartInStorage.ChartAreas["ChartCountArea"].AxisX.MajorGrid.Interval = 1;
                ChartInStorage.ChartAreas["ChartCountArea"].AxisX.LineWidth = 1;
                ChartInStorage.ChartAreas["ChartCountArea"].AxisY.LineWidth = 1;


                ChartInStorage.ChartAreas["ChartCountArea"].AxisY.Title = "配送率";
                ChartInStorage.ChartAreas["ChartCountArea"].AxisX.Title = "医院";


                ChartMoney.ChartAreas["ChartMoneyArea"].AxisX.IsMarginVisible = true;
                ChartMoney.ChartAreas["ChartMoneyArea"].AxisX.LabelStyle.Font = new Font("宋体", 8);
                ChartMoney.ChartAreas["ChartMoneyArea"].Area3DStyle.Enable3D = false;

                ChartMoney.Series["日常采购"]["PointWidth"] = "0.5";
                ChartMoney.Series["临时采购"]["PointWidth"] = "0.5";
                ChartMoney.Series["应急采购"]["PointWidth"] = "0.5";
                ChartMoney.ChartAreas["ChartMoneyArea"].AxisX.MajorGrid.Interval = 1;
                ChartMoney.ChartAreas["ChartMoneyArea"].AxisX.LineWidth = 1;
                ChartMoney.ChartAreas["ChartMoneyArea"].AxisY.LineWidth = 1;


                ChartMoney.ChartAreas["ChartMoneyArea"].AxisY.Title = "金额（万元）";
                ChartMoney.ChartAreas["ChartMoneyArea"].AxisX.Title = "医院";

            }
            else
            {
                this.divTable.Visible = false;

                //隐藏金额图表
                this.ChartMoney.Visible = false;

                this.btnExcel.Visible = false;

                //提示按钮显示出来
                lblnull.Visible = true;
            }


        }

        /// <summary>
        /// 第一次绑定序列集合
        /// 董辉
        /// 2011-4-9 17:11
        /// </summary>
        /// <param name="row">当前行数据</param>
        /// <param name="ParameType">采购类型</param>
        /// <param name="BaseI">基本药品目录循环因子</param>
        /// <param name="ComplementI">补充目录循环因子</param>
        /// <param name="Base_2010I">2010基本药物循环因子</param>
        /// <param name="PriceFixing_2010I">临时采购目录循环因子</param>
        /// <param name="Complementarity_2010I">应急采购目录循环因子</param>
        /// <param name="BasicCatalog_Money">基本药物目录采购金额序列</param>
        /// <param name="ComplementarityCatalog_Money">补充目录采购金额序列</param>
        /// <param name="BasicCatalog_2010_Money">2010基本药物采购金额序列</param>
        /// <param name="PriceFixing_2010_Money">临时采购目录采购金额序列</param>
        /// <param name="ComplementarityCatalog_2010_Money">应急采购目录采购金额序列</param>
        /// <param name="BasicCatalog_Count">基本药物目录采购数量序列</param>
        /// <param name="ComplementarityCatalog_Count">补充目录采购数量序列</param>
        /// <param name="BasicCatalog_2010_Count">2010基本药物采购数量序列</param>
        /// <param name="PriceFixing_2010_Count">临时采购目录采购数量序列</param>
        /// <param name="ComplementarityCatalog_2010_Count">应急采购目录采购数量序列</param>
        private void InitBindChart(DataRow row,
                                   string ParameType,
            //int BaseI,
            //int ComplementI,
                                   int Base_2010I,
            int PriceFixing_2010I,
            int Complementarity_2010I,

                                   Series BasicCatalog_2010_Money,
            Series PriceFixing_2010_Money,
            Series ComplementarityCatalog_2010_Money,
                                   Series BasicCatalog_2010_PSRate,
        Series PriceFixing_2010_PSRate,
        Series ComplementarityCatalog_2010_PSRate)
        {
            if (row != null)
            {
                switch (ParameType)
                {
                    //日常采购目录
                    case "0":
                        //日常采购目录采购金额序列
                        BasicCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        BasicCatalog_2010_Money.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购目采购金额：{1}", row["HospitalName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");

                        ////日常采购目录采购数量序列
                        BasicCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), row["DistributeRate"].ToString());
                        BasicCatalog_2010_PSRate.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["HospitalName"].ToString(), row["addDistributeRate"].ToString());

                        //临时采购目录采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["HospitalName"].ToString(), 0);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["HospitalName"].ToString(), "0 万元");

                        ////临时采购目录采购数量序列
                        PriceFixing_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), 0);
                        PriceFixing_2010_PSRate.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["HospitalName"].ToString(), "0%");

                        //应急采购目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), 0);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["HospitalName"].ToString(), "0 万元");

                        ////应急采购目录采购数量序列
                        ComplementarityCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), 0);
                        ComplementarityCatalog_2010_PSRate.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["HospitalName"].ToString(), "0%");

                        break;

                    //临时采购目录
                    case "1":

                        //日常采购目录采购金额序列
                        BasicCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), 0);
                        BasicCatalog_2010_Money.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["HospitalName"].ToString(), "0 万元");

                        //日常采购目录采购数量序列
                        BasicCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), 0);
                        BasicCatalog_2010_PSRate.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["HospitalName"].ToString(), "0%");

                        //临时采购目录采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["HospitalName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["HospitalName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        ////临时采购目录采购数量序列
                        PriceFixing_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), row["DistributeRate"].ToString());
                        PriceFixing_2010_PSRate.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["HospitalName"].ToString(), row["addDistributeRate"].ToString());

                        //应急采购目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), 0);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["HospitalName"].ToString(), "0 万元");

                        //应急采购目录采购数量序列
                        ComplementarityCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), 0);
                        ComplementarityCatalog_2010_PSRate.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["HospitalName"].ToString(), "0%");

                        break;

                    //应急采购目录
                    case "2":

                        //日常采购目录采购金额序列
                        BasicCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), 0);
                        BasicCatalog_2010_Money.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["HospitalName"].ToString(), "0 万元");

                        ////日常采购目录采购数量序列
                        BasicCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), 0);
                        BasicCatalog_2010_PSRate.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["HospitalName"].ToString(), "0%");

                        //临时采购目录采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["HospitalName"].ToString(), 0);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["HospitalName"].ToString(), "0 万元");

                        ////临时采购目录采购数量序列
                        PriceFixing_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), 0);
                        PriceFixing_2010_PSRate.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["HospitalName"].ToString(), "0%");

                        //应急采购目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["HospitalName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        ////应急采购目录采购数量序列
                        ComplementarityCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), row["DistributeRate"].ToString());
                        ComplementarityCatalog_2010_PSRate.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["HospitalName"].ToString(), row["addDistributeRate"].ToString());

                        break;
                }
            }
        }


        /// <summary>
        /// 最终绑定序列集合
        /// 董辉
        /// 2011-4-9 17:21
        /// </summary>
        /// <param name="row">当前行数据</param>
        /// <param name="ParameType">采购类型</param>
        /// <param name="BaseI">基本药品目录循环因子</param>
        /// <param name="ComplementI">补充目录循环因子</param>
        /// <param name="Base_2010I">日常采购目录循环因子</param>
        /// <param name="PriceFixing_2010I">临时采购目录循环因子</param>
        /// <param name="Complementarity_2010I">应急采购目录循环因子</param>
        /// <param name="BasicCatalog_Money">基本药物目录采购金额序列</param>
        /// <param name="ComplementarityCatalog_Money">补充目录采购金额序列</param>
        /// <param name="BasicCatalog_2010_Money">日常采购目录采购金额序列</param>
        /// <param name="PriceFixing_2010_Money">临时采购目录采购金额序列</param>
        /// <param name="ComplementarityCatalog_2010_Money">应急采购目录采购金额序列</param>
        /// <param name="BasicCatalog_Count">基本药物目录采购数量序列</param>
        /// <param name="ComplementarityCatalog_Count">补充目录采购数量序列</param>
        /// <param name="BasicCatalog_2010_Count">日常采购目录采购数量序列</param>
        /// <param name="PriceFixing_2010_Count">//临时采购目录采购数量序列</param>
        /// <param name="ComplementarityCatalog_2010_Count">应急采购目录采购数量序列</param>
        private void FinishBindChart(DataRow row,
                                     string ParameType,
            //int BaseI,
            //int ComplementI,
                                     int Base_2010I,
            int PriceFixing_2010I,
            int Complementarity_2010I,
                                     Series BasicCatalog_2010_Money,
            Series PriceFixing_2010_Money,
            Series ComplementarityCatalog_2010_Money,
                                     Series BasicCatalog_2010_PSRate,
        Series PriceFixing_2010_PSRate,
        Series ComplementarityCatalog_2010_PSRate)
        {
            if (row != null)
            {
                switch (ParameType)
                {

                    //日常采购目录
                    case "0":

                        //上次绑定的日常采购目录采购金额数据移除，重新绑定新的数据
                        BasicCatalog_2010_Money.Points.RemoveAt(Base_2010I - 1);
                        //日常采购目录采购金额序列
                        BasicCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        BasicCatalog_2010_Money.Points[Base_2010I - 1].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["HospitalName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        //上次绑定的日常采购目录采购数量数据移除，重新绑定新的数据
                        BasicCatalog_2010_PSRate.Points.RemoveAt(Base_2010I - 1);
                        BasicCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), row["DistributeRate"].ToString());
                        BasicCatalog_2010_PSRate.Points[Base_2010I - 1].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["HospitalName"].ToString(), row["addDistributeRate"].ToString());

                        break;

                    //临时采购目录
                    case "1":

                        //上次绑定的临时采购目录采购金额数据移除，重新绑定新的数据
                        PriceFixing_2010_Money.Points.RemoveAt(PriceFixing_2010I - 1);
                        //临时采购目录采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["HospitalName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I - 1].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["HospitalName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        ////上次绑定的临时采购目录采购数量数据移除，重新绑定新的数据
                        PriceFixing_2010_PSRate.Points.RemoveAt(PriceFixing_2010I - 1);
                        //临时采购目录采购数量序列
                        PriceFixing_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), row["DistributeRate"].ToString());
                        PriceFixing_2010_PSRate.Points[PriceFixing_2010I - 1].ToolTip = string.Format("{0}\n临时采购配送率{1}", row["HospitalName"].ToString(), row["addDistributeRate"].ToString());

                        break;

                    //应急采购目录
                    case "2":

                        //上次绑定的应急采购目录采购金额数据移除，重新绑定新的数据
                        ComplementarityCatalog_2010_Money.Points.RemoveAt(Complementarity_2010I - 1);
                        //应急采购目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["HospitalName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I - 1].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["HospitalName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        ////上次绑定的应急采购目录采购数量数据移除，重新绑定新的数据
                        ComplementarityCatalog_2010_PSRate.Points.RemoveAt(Complementarity_2010I - 1);
                        ////应急采购目录采购数量序列
                        ComplementarityCatalog_2010_PSRate.Points.AddXY(row["HospitalName"].ToString(), row["DistributeRate"].ToString());
                        ComplementarityCatalog_2010_PSRate.Points[Complementarity_2010I - 1].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["HospitalName"].ToString(), row["addDistributeRate"].ToString());

                        break;
                }
            }
        }

    }
}